<html>  
    <head>  
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title></title>  
    <script language=javascript> 
    function doPrint() {
    winname = window.open('', "_blank",'');
    bdhtml=window.document.body.innerHTML; 
    sprnstr="<!--startprint-->"; 
    eprnstr="<!--endprint-->"; 
    prnhtml=bdhtml.substr(bdhtml.indexOf(sprnstr)+17); 
    prnhtml=prnhtml.substring(0,prnhtml.indexOf(eprnstr)); 
    winname.document.body.innerHTML=prnhtml;
    winname.print(); 
    }
    </script>
    </head> 
    
    <body>  
    <div>1111111111111</div>
    <!--startprint-->
    <div>2222222222222</div>
    <!--endprint-->
    <input type="button" onClick="doPrint();" value="打印" />
    </body>  
    </html>  